package com.ruoyi.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mapper.BasisAntennaMapper;
import com.ruoyi.domain.BasisAntenna;
import com.ruoyi.service.IBasisAntennaService;

/**
 * 天线Service业务层处理
 * 
 * @author wangzebing
 * @date 2025-05-16
 */
@Service
public class BasisAntennaServiceImpl implements IBasisAntennaService 
{
    @Autowired
    private BasisAntennaMapper basisAntennaMapper;

    /**
     * 查询天线
     * 
     * @param antennaId 天线主键
     * @return 天线
     */
    @Override
    public BasisAntenna selectBasisAntennaByAntennaId(Long antennaId)
    {
        return basisAntennaMapper.selectBasisAntennaByAntennaId(antennaId);
    }

    /**
     * 查询天线列表
     * 
     * @param basisAntenna 天线
     * @return 天线
     */
    @Override
    public List<BasisAntenna> selectBasisAntennaList(BasisAntenna basisAntenna)
    {
        return basisAntennaMapper.selectBasisAntennaList(basisAntenna);
    }

    /**
     * 新增天线
     * 
     * @param basisAntenna 天线
     * @return 结果
     */
    @Override
    public int insertBasisAntenna(BasisAntenna basisAntenna)
    {

        int i = basisAntennaMapper.insertBasisAntenna(basisAntenna);

        if (i > 0){
            boolean b = basisAntennaMapper.addBasisPositionAntenna(basisAntenna);
            if (b == true){
                return 1;
            }
        }

        return i;
    }

    /**
     * 修改天线
     * 
     * @param basisAntenna 天线
     * @return 结果
     */
    @Override
    public int updateBasisAntenna(BasisAntenna basisAntenna)
    {
        return basisAntennaMapper.updateBasisAntenna(basisAntenna);
    }

    /**
     * 批量删除天线
     * 
     * @param antennaIds 需要删除的天线主键
     * @return 结果
     */
    @Override
    public int deleteBasisAntennaByAntennaIds(Long[] antennaIds)
    {
        return basisAntennaMapper.deleteBasisAntennaByAntennaIds(antennaIds);
    }

    /**
     * 删除天线信息
     * 
     * @param antennaId 天线主键
     * @return 结果
     */
    @Override
    public int deleteBasisAntennaByAntennaId(Long antennaId)
    {
        return basisAntennaMapper.deleteBasisAntennaByAntennaId(antennaId);
    }
    //给阵地添加天线
    @Override
    public int addBasisPositionAntenna(BasisAntenna antenna) {
        boolean b = basisAntennaMapper.addBasisPositionAntenna(antenna);
        if (b == true)return 1;
        return 0;
    }
}
